package com.ruiyi.subway.utils;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

import org.apache.commons.io.IOUtils;

public class PropertiesUtil {
	public static Properties loadClasspathProperties(String fileName){
		Properties properties = new Properties();
        InputStream ins = PropertiesUtil.class.getClassLoader().getResourceAsStream(fileName);
        try {
            properties.load(new InputStreamReader(ins, "UTF-8"));
            return properties;
        } catch (IOException e) {
            throw new RuntimeException(String.format("读取%s配置文件失败", fileName),e);
        }finally {
        	IOUtils.closeQuietly(ins);
		}
	}
}
